﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Task
{
    class Transform
    {
    //    x be 10 We  y be 10
        Color clr;
        public Bitmap Translate(int width, int height,int xpos, int ypos, myclr[,] img)
      {

         
          Bitmap resulted_image = new Bitmap(width, height);
          for (int i = 0; i < width; i++)
            {

                for (int j = 0; j < height; j++)
                {
                    clr = Color.FromArgb(img[i, j].r, img[i, j].g, img[i, j].b);// da bagamma3 feeh el loon tany m3 ba3d(the saved values of R,G,B of each pixel)
                    if ((i < xpos && xpos >= 0) || (j < ypos && ypos >= 0) || (i > width + xpos && xpos < 0) || (j > height+ ypos && ypos < 0))
                    resulted_image.SetPixel(i, j, Color.Black);
              
                    
                    if ((i + xpos < width && i + xpos >= 0) && (j + ypos < height && j + ypos>=0))
                    {
                        resulted_image.SetPixel(i+xpos, j+ypos, clr);
                    }

                }
                
            }
           return resulted_image;
      }
    }
}
